package com.yantong.mapper;

import com.yantong.pojo.PayChannel;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;

import java.util.List;
import java.util.Map;

/**
 * @author kanghaixin
 * @date 2018/10/21.16:38
 */
public interface PayChannelMapper {
    /**
     * 条件统计
     * @param params
     * @return
     */
    int countByParams(Map<String, Object> params);

    /**
     * 条件查询
     * @param params
     * @param rowBounds
     * @return
     */
    List<PayChannel> listByParams(Map<String, Object> params, RowBounds rowBounds);

    /**
     * 获取详情
     * @param id
     * @return
     */
    PayChannel selectByPrimaryKey(Long id);

    /**
     * 删除
     * @param id
     * @return
     */
    int deleteByPrimaryKey(Long id);

    /**
     * 新增
     * @param payChannel
     * @return
     */
    int insertSelective(PayChannel payChannel);

    /**
     * 更新
     * @param payChannel
     * @return
     */
    int updateByPrimaryKeySelective(PayChannel payChannel);

    /**
     * 所有可用的支付通道
     * @return
     */
    List<PayChannel> listAllChannels();
    /**
     * 获取商户有效支付通道
     * @return
     */
	PayChannel getFirstChannel(Long centerId);

    /**
     * 获取平台有效支付通道
     * @return
     */
    PayChannel getPlatformFirstChannel();

    List<PayChannel> getPlatformChannels();

    PayChannel getChannelByCodeAndCenterId(@Param("channelCode") String channelCode, @Param("centerId") Long centerId);

    int updateByCentreIdSelective(PayChannel pc);
}
